package com.biallen.datastructure.linkedlist;

import com.biallen.datastructure.entity.HeroNode;

/**
 * 单项链表 算法
 */
public class SingleLinkedListDemo {

    public static void main(String[] args) {
        SingleLinkedList singleLinkedList = new SingleLinkedList();
//        singleLinkedList.add(new HeroNode(1, "宋江", "及时雨"));
//        singleLinkedList.add(new HeroNode(2, "卢俊义", "玉麒麟"));
//        singleLinkedList.add(new HeroNode(3, "吴用", "智多星"));
//        singleLinkedList.add(new HeroNode(4, "公孙胜", "入云龙"));
//        singleLinkedList.add(new HeroNode(5, "关胜", "大刀"));
//        singleLinkedList.add(new HeroNode(6, "豹子头", "林冲"));
        System.out.println("按照顺序添加----------->");
        singleLinkedList.addByOrder(new HeroNode(1, "宋江", "及时雨"));
        singleLinkedList.addByOrder(new HeroNode(3, "吴用", "智多星"));
        singleLinkedList.addByOrder(new HeroNode(5, "关胜", "大刀"));
        singleLinkedList.addByOrder(new HeroNode(6, "林冲", "豹子头"));
        singleLinkedList.addByOrder(new HeroNode(4, "公孙胜", "入云龙"));
        singleLinkedList.addByOrder(new HeroNode(2, "卢俊义", "玉麒麟"));
        singleLinkedList.displayList();
        System.out.println("更新----------->");
        singleLinkedList.update(new HeroNode(6, "豹子头", "林冲"));
        singleLinkedList.displayList();
        System.out.println("删除----------->");
        singleLinkedList.del(new HeroNode(4, "公孙胜", "入云龙"));
        singleLinkedList.displayList();
    }
}






